<?php echo $form->create('Newsletter',array('url'=>'/'.$this->params['url']['url']));?>
	<fieldset>
 		<legend><?php __('Add Newsletter');?></legend>
	<?php
	
		$output = $html->button(__('Unsubscribe link'), null, array('onclick'=>'insertUnsubscribeLink();return false;'));
		echo $form->input("newsletter_type",array("type"=>"select","label"=>__("Newsletter type"),"options"=>$newsletterTypes,"default"=>null));
		echo $form->input('subject');
		echo $form->input('body_html', array('type'=>'editor','rows'=>20, 'cols'=>'50','after'=>$output));
		echo $form->input('body_text', array('type'=>'textarea', 'rows'=>10, 'cols'=>'50', 'buttons'=>array('plugin'=>'users','model'=>'user','fields'=>array('unsubscribe_link'))));
	?>
	</fieldset>
<?php echo $form->end(__('Submit'));?>
<script type="text/javascript">
function insertUnsubscribeLink()
{
	//tinyMCE.editors.NewsletterBodyHtml.selection.setContent('[[unsubscribe_link]]');
	CKEDITOR.instances.NewsletterBodyHtml.insertHtml("[[unsubscribe_link]]");
}
</script>
